import service from '/@/utils/request';

export const usePosPointCreateApi = (formData: object) => {
    return service({
        url: `v0/pos/point/create`,
        method: 'POST',
        data: formData
    });
}

export const usePosPointPageApi = (formData?: object) => {
    return service({
        url: `v0/pos/point/page`,
        method: 'POST',
        data: formData
    });
}

export const usePosPointDeleteApi = (param: string | string[]) => {
    let arrList: string[] = []

    if (param instanceof Array) {
        arrList = param
    } else {
        arrList.push(param)
    }

    return service({
        url: `v0/pos/point/delete`,
        method: 'DELETE',
        data: { codeList: arrList }
    });
}

export const usePosPointUpdateApi = (formData: object) => {
    return service({
        url: `v0/pos/point/update`,
        method: 'PUT',
        data: formData
    });
}

export const usePosPointExportApi = (formData?: object) => {
    return service({
        url: `v0/pos/point/export`,
        method: 'POST',
        data: formData
    });
}
